package com.xp.pgoj.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import javax.annotation.Resource;

/**
 * @author <a href=""https://github.com/Fzs0>逢左使</a>
 * @create 2024/09/24 20:10
 * @Description: 设置webSocket终端服务
 */
@Configuration
public class WebsocketConfig {

    @Resource
    private TomcatServletWebServerFactory webServerFactory;

    @Bean
    public ServerEndpointExporter serverEndpointExporter(){
        System.out.println("Server running on port: " + webServerFactory.getPort());
        return new ServerEndpointExporter();
    }

}
